package com.imau.bean;

import com.alibaba.fastjson.annotation.JSONField;
import com.imau.common.utils.IdWorkerGen;
import io.mybatis.provider.Entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

@Entity.Table("t_user")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class User {

    /**用户ID*/
    @Entity.Column(id = true ,genId = IdWorkerGen.class, updatable = false)
    private String id;
    private String mobile;
    private String username;
    private String password;

    public User(String mobile) {
        this.mobile = mobile;
    }

    public User(String mobile,String username) {
        this.username = username;
        this.mobile = mobile;
    }

    /**启用状态 0是禁用，1是启用*/
    private String status;

    @JSONField(format = "yyyy-MM-dd HH:mm:ss") //数据库导出页面时json格式化
    private Date createTime;

    private String did;


    @JSONField(format = "yyyy-MM-dd HH:mm:ss") //数据库导出页面时json格式化
    private Date updateTime;


    /**增加角色的属性  标记不是数据库字段*/
    @Entity.Transient
    private Set<Role> roles = new HashSet<>(0);

    /**部门对象*/
    @Entity.Transient
    private SysDept dept;
}
